package Dome01;

import java.util.Arrays;

public class Test {
    public static void main(String[] args) throws CloneNotSupportedException{
        Animal animal = new Animal("张三",10);
        Animal animal1 = (Animal)animal.clone();
        System.out.println(animal);
        System.out.println(animal1);
    }
}

class Animal implements Cloneable{
    String names;
    int height;
    @Override
    public String toString() {
        return "Animal{" +
                "name='" + name + '\'' +
                ", height=" + height +
                '}';
    }

    public Animal(String name, int height) {
        this.name = name;
        this.height = height;
    }

    @Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }
}

